import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout/Layout.vue'

// 路由地址
export const constantRoutes = [
  {
    name: 'Main',
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      // {
      //   name: 'Home',
      //   path: '/home',
      //   icon: '',
      //   component: () => import('@/views/home/components/Home.vue'),
      //   meta: { title: '首页' }
      // },
      // {
      //   name: 'PersonalCenter',
      //   path: 'personal-center',
      //   icon: '',
      //   component: () => import('@/views/personalCenter/components/PersonalCenter.vue'),
      //   meta: { title: '个人中心' }
      // },
      // {
      //   name: 'Setting',
      //   path: '/setting',
      //   meta: { title: '系统设置' },
      //   redirect: '/system/user-manage',
      //   children: [
      //     {
      //       name: 'UserManage',
      //       path: 'user-manage',
      //       icon: '',
      //       component: () => import('@views/userManage/components/userManage'),
      //       meta: { title: '用户管理' }
      //     },
      //     {
      //       name: 'DeptManage',
      //       path: 'dept-manage',
      //       icon: '',
      //       component: () => import('@views/deptManage/components/DeptManage'),
      //       meta: { title: '部门管理' }
      //     },
      //     {
      //       name: 'RoleManage',
      //       path: 'role-manage',
      //       icon: '',
      //       component: () => import('@views/roleManage/components/RoleManage'),
      //       meta: { title: '角色管理' }
      //     },
      //     {
      //       name: 'MenuManage',
      //       path: 'menu-manage',
      //       icon: '',
      //       component: () => import('@views/menuManage/components/MenuManage'),
      //       meta: { title: '菜单管理' }
      //     },
      //     {
      //       name: 'DictManage',
      //       path: 'dict-manage',
      //       icon: '',
      //       component: () => import('@views/dictManage/components/DictManage'),
      //       meta: { title: '字典管理' }
      //     },
      //     {
      //       name: 'DictDetail',
      //       path: 'dict-detail',
      //       icon: '',
      //       component: () => import('@views/dictManage/components/DictDetail'),
      //       meta: { title: '字典详情' }
      //     },
      //     {
      //       name: 'LogManage',
      //       path: 'log-manage',
      //       icon: '',
      //       component: () => import('@views/logManage/components/LogManage'),
      //       meta: { title: '审计日志' }
      //     },
      //     {
      //       name: 'NoticeManage',
      //       path: 'notice-manage',
      //       icon: '',
      //       component: () => import('@views/noticeManage/components/NoticeManage'),
      //       meta: { title: '通知管理' }
      //     },
      //     {
      //       name: 'NoticeEdit',
      //       path: 'notice-edit',
      //       icon: '',
      //       component: () => import('@views/noticeManage/components/NoticeEdit'),
      //       meta: { title: '通知编辑' }
      //     },
      //     {
      //       name: 'MyNotice',
      //       path: 'my-notice',
      //       icon: '',
      //       component: () => import('@views/myNotice/components/MyNotice'),
      //       meta: { title: '我的通知' }
      //     },
      //     {
      //       name: 'TestPage',
      //       path: 'test-page',
      //       icon: '',
      //       component: () => import('@views/testPage/components/TestPage'),
      //       meta: { title: '测试页面' }
      //     }
      //   ]
      // }
    ]
  },
  // 登录
  {
    name: 'Login',
    path: '/login',
    component: () => import('@views/login/Login.vue')
  },
  // 忘记密码
  {
    name: 'Forgot',
    path: '/forgot',
    component: () => import('@views/login/Forgot.vue')
  },
  {
    path: '/401',
    name: 'Page401',
    component: () => import('@views/exception/401.vue')
  },
  {
    path: '/404',
    name: 'Page404',
    component: () => import('@views/exception/404.vue')
  },
  {
    path: '/:catchAll(.*)',
    component: () => import('@views/exception/404.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
  // 刷新时，滚动条位置还原
  scrollBehavior: () => ({ left: 0, top: 0 })
})

export default router
